<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        let num = parseInt(Math.random() * 101)
        for (let i = 4; i >= 0; i--) {
            let num1 = prompt('请输入一个数字')
            if (num1 > num) {
                alert('您输入的数字大了，您还有' + i + '次机会')
            } else if (num1 < num) {
                alert('您输入的数字小了，您还有' + i + '次机会')
            } else {
                alert('牛逼啊！您猜对了')
                break
            }
            if (i === 0) {
                alert('不好意思！您没有猜对，这个数字是' + num)
            }
        }






















    </script>
</body>

</html>